//
// Created by wsl on 2024/3/8.
//

#ifndef __DATASTRUCTURE_SQSTACK_H
#define __DATASTRUCTURE_SQSTACK_H

#include "DataStructure_common.h"

#define SqStack_Create(T, initSize)        	SqStack_create(sizeof (T), initSize)



typedef struct {
	T base;              		//栈低，起始地址

	int length;
	uin32_t capacity;    		//容量，当前允许的做大长度
	uint8_t initSize;			//初始容量
	uin32_t dataSize;    		//数据大小
} SqStk, *SqStack;



DataStructure_Warning_Unused
int SqStack_length(SqStack stack);

DataStructure_Warning_Unused
Status SqStack_isEmpty(SqStack stack);

DataStructure_Warning_Unused
SqStack SqStack_create(size_t dataSize, uint8_t initSize);

DataStructure_Warning_Unused
Status SqStack_push(SqStack stack, T e);

DataStructure_Warning_Unused
Status SqStack_top(SqStack stack, T buf);

DataStructure_Warning_Unused
Status SqStack_pop(SqStack stack, T buf);

DataStructure_Warning_Unused
Status SqStack_clear(SqStack stack);

DataStructure_Warning_Unused
Status SqStack_destroy(SqStack *stack);

#endif //__DATASTRUCTURE_SQSTACK_H
